
public class InsertionSort<Type extends Comparable<Type>> extends SorterParent<Type> {

	@Override
	public Type[] sort(Type[] toSort, String method) {
		super.sort(toSort, method);
		try {
			for (int i = 1; i < toSort.length; i++) {
				Type tmp = toSort[i];
				log.add("   New foreach round. \n");

				int j = i;
				for (; j > 0 && tmp.compareTo(toSort[j - 1]) < 0; j--) {
					toSort[j] = toSort[j - 1];
					steps++;
				}
				toSort[j] = tmp;
				log.add("   End of foreach round. \n");
			}
			endTime = System.nanoTime();
			log.add("End of log. Nanotime is: " + endTime);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return toSort;
	}
}